//
//  UserInfoViewController.m
//  gpos_app
//
//  Created by 崔航飞 on 2018/8/15.
//  Copyright © 2018年 apple. All rights reserved.
//

#import "UserInfoViewController.h"
#import "Masonry.h"
#import "Tools.h"
#import "SkyerCityPicker.h"
#import "IdentityVerificationViewController.h"
#import "UIImageView+WebCache.h"
#import "EWMCodeViewController.h"
#import "GPosAPI.h"
#import "SVProgressHUD.h"
#import "AFNetworking.h"
#import "XMRegisterViewController.h"
#import "WKProgressHUD.h"
@interface UserInfoViewController ()<UIGestureRecognizerDelegate,UIImagePickerControllerDelegate,UINavigationControllerDelegate,SkyerCityPickerDelegate,UITextFieldDelegate>
@property (nonatomic,strong) UIView *backgroundViews;
@property (nonatomic,strong) UIView *viewOne;
@property (nonatomic,strong) UIView *viewTwo;
@property (nonatomic,strong) UIView *viewThree;
@property (nonatomic,strong) UIView *viewFour;
@property (nonatomic,strong) UIView *viewFive;
@property (nonatomic,strong) UIView *viewSix;
@property (nonatomic,strong) UIView *viewSeven;
@property (nonatomic,strong) UILabel *labSecond;
@property (nonatomic,strong) UILabel *labThred;
@property (nonatomic,strong) UILabel *labFours;
@property (nonatomic,strong) UILabel *labFives;
@property (nonatomic,strong) UILabel *labSixes;
@property (nonatomic,strong) UILabel *labSevens;
@property (nonatomic,strong) UIView *viewEWM;
@property (nonatomic,strong) UIView *viewMoneyaddress;
@property (nonatomic,strong) UIScrollView *scrollView;
@property (nonatomic,strong) WKProgressHUD *hud;
//头像imageView
@property (nonatomic,strong) UIImageView *HeaderImageView;
@property (nonatomic,strong) NSString *MoneyAddress;
@property (nonatomic,strong) NSString *headerUrlstr;
@property (nonatomic,strong) NSString *str1;
@property (nonatomic,strong) NSString *str2;
@property (nonatomic,assign) NSInteger status;//身份验证
@property (nonatomic,strong) NSString *city;
@property (nonatomic,assign) NSString * gender;
@property (nonatomic,strong) UITextField*tees;
@end

@implementation UserInfoViewController
-(void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    self.navigationController.navigationBar.hidden=NO;
    //去掉返回的文字
    self.navigationController.navigationBar.topItem.title = @"";
    self.navigationItem.title=@"用户信息";
    
        [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleDefault;
    
    int userId=[[[NSUserDefaults standardUserDefaults] objectForKey:@"userId"] intValue];
    __weak typeof(self) weakSelf = self;
    NSDictionary * dic =[NSDictionary dictionaryWithObjectsAndKeys:@(userId),@"userId", nil];
    [GPosAPI requestUserInfosWithParams:dic andCallback:^(id obj) {
        if (obj==nil)
        {
            
            [SVProgressHUD showErrorWithStatus:@"请求失败,请检查您的网络状态"];
            [SVProgressHUD setDefaultStyle:SVProgressHUDStyleDark];
            [SVProgressHUD setDefaultAnimationType:SVProgressHUDAnimationTypeFlat];
            [weakSelf initUI:0];
        }else{
            
            if ([[obj objectForKey:@"code"] integerValue] ==200)
            {
                NSDictionary *datas=[obj objectForKey:@"data"];
                // 对URL字符串进行 URL 编码，避免中文乱码问题
                weakSelf.headerUrlstr = [datas objectForKey:@"portrait"] ;
                weakSelf.str1=[datas objectForKey:@"nickName"];
                weakSelf.str2=[datas objectForKey:@"phone"];
                weakSelf.status=[[datas objectForKey:@"status"] integerValue];
                if ([[datas objectForKey:@"gender"] isKindOfClass:[NSNull class]])
                {
                    weakSelf.gender=@"0";
                }else{
                    weakSelf.gender=[NSString stringWithFormat:@"%ld",[[datas objectForKey:@"gender"] integerValue]];
                }
                if ([[datas objectForKey:@"city"] isKindOfClass:[NSNull class]])
                {
                    weakSelf.city=@"";
                    
                }else{
                    
                    weakSelf.city=[datas objectForKey:@"city"];
                }
                
                [weakSelf initUI:1];
            }else if ([[obj objectForKey:@"code"] integerValue]==401 || [[obj objectForKey:@"code"] intValue] == 402){
                
                 [[NSNotificationCenter defaultCenter] postNotificationName:@"NewLoginInView" object:nil];
                UIStoryboard * mainStory = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
                XMRegisterViewController *VC = [mainStory instantiateInitialViewController];
                [[NSUserDefaults standardUserDefaults] removeObjectForKey:@"passWord"];
                VC.hidesBottomBarWhenPushed=YES;
                //设置当前窗口的根控制器
               [UIApplication sharedApplication].keyWindow.rootViewController=VC;
                [SVProgressHUD showInfoWithStatus:[obj objectForKey:@"message"]];
                [SVProgressHUD setDefaultStyle:SVProgressHUDStyleDark];
                [SVProgressHUD setDefaultAnimationType:SVProgressHUDAnimationTypeFlat];
                
            }
            else{
                
                [SVProgressHUD showErrorWithStatus:[obj objectForKey:@"message"]];
                [SVProgressHUD setDefaultStyle:SVProgressHUDStyleDark];
                [SVProgressHUD setDefaultAnimationType:SVProgressHUDAnimationTypeFlat];
                [weakSelf initUI:2];
            }
        }
    }];
}
-(void)viewWillDisappear:(BOOL)animated{
    [super viewWillDisappear:animated];
    [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;
    
}
-(void)viewDidLayoutSubviews{
    
    [super viewDidLayoutSubviews];
    self.tabBarController.tabBar.hidden = YES;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.view.backgroundColor=[UIColor colorWithWhite:0.94 alpha:1];
    self.navigationController.navigationBar.backgroundColor=[UIColor whiteColor];
    self.navigationController.navigationBar.tintColor=[UIColor blackColor];
    //利用scrollView设置适配页面
    self.scrollView=[[UIScrollView alloc]init];
    [self.view addSubview:self.scrollView];
    
    [self.scrollView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.view.mas_top).offset(kNavbarHeight);
        make.left.equalTo(self.view.mas_left);
        make.right.equalTo(self.view.mas_right);
        make.height.equalTo(@(KmainScreenHeiht - kNavbarHeight - kBottomSafeHeight));
        
    }];
    
    self.scrollView.alwaysBounceVertical=YES;
    
    self.scrollView.scrollEnabled=YES;
    
    self.scrollView.showsVerticalScrollIndicator=NO;
    

}
-(void)initUI:(NSInteger)num{
    
    self.backgroundViews=[[UIView alloc] init];
    self.backgroundViews.backgroundColor=[UIColor colorWithWhite:0.94 alpha:1];
    [self.scrollView addSubview:self.backgroundViews];
    [self.backgroundViews mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.edges.equalTo(self.scrollView);
        
        make.width.equalTo(self.scrollView);
        
    }];
    
    self.viewOne = [[UIView alloc] init];
    self.viewOne.backgroundColor = [UIColor whiteColor];
    UITapGestureRecognizer *tapOne=[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapViewOneClick:)];
    tapOne.delegate = self;
    [self.viewOne addGestureRecognizer:tapOne];
    [self.backgroundViews addSubview:self.viewOne];
    [self.viewOne mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.backgroundViews.mas_top).offset(10);
        make.left.equalTo(self.backgroundViews.mas_left).offset(0);
        make.right.equalTo(self.backgroundViews.mas_right).offset(0);
        make.height.equalTo(@(96));
        
    }];
    
    self.viewTwo = [[UIView alloc] init];
    self.viewTwo.backgroundColor = [UIColor whiteColor];
    UITapGestureRecognizer *tapTwo=[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapViewTwoClick:)];
    tapTwo.delegate = self;
    [self.viewTwo addGestureRecognizer:tapTwo];
    [self.backgroundViews addSubview:self.viewTwo];
    [self.viewTwo mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.viewOne.mas_bottom).offset(10);
        make.left.equalTo(self.backgroundViews.mas_left).offset(0);
        make.right.equalTo(self.backgroundViews.mas_right).offset(0);
        make.height.equalTo(@(48));
        
    }];
    
    self.viewThree = [[UIView alloc] init];
    self.viewThree.backgroundColor = [UIColor whiteColor];
    UITapGestureRecognizer *tapThree=[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapViewThreeClick:)];
    tapThree.delegate = self;
    [self.viewThree addGestureRecognizer:tapThree];
    [self.backgroundViews addSubview:self.viewThree];
    [self.viewThree mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.viewTwo.mas_bottom).offset(1.2);
        make.left.equalTo(self.backgroundViews.mas_left).offset(0);
        make.right.equalTo(self.backgroundViews.mas_right).offset(0);
        make.height.equalTo(@(48));
        
    }];
    /*
    self.viewEWM = [[UIView alloc] init];
    self.viewEWM.backgroundColor = [UIColor whiteColor];
    UITapGestureRecognizer *tapEWM=[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapsEWM:)];
    tapEWM.delegate = self;
    [self.viewEWM addGestureRecognizer:tapEWM];
    [self.backgroundViews addSubview:self.viewEWM];
    [self.viewEWM mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.viewThree.mas_bottom).offset(10);
        make.left.equalTo(self.backgroundViews.mas_left).offset(0);
        make.right.equalTo(self.backgroundViews.mas_right).offset(0);
        make.height.equalTo(@(48));
        
    }];
    
    self.viewMoneyaddress = [[UIView alloc] init];
    self.viewMoneyaddress.backgroundColor = [UIColor whiteColor];
    UITapGestureRecognizer *tapMoneyaddress=[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapsMoneyaddress:)];
    tapMoneyaddress.delegate = self;
    [self.viewMoneyaddress addGestureRecognizer:tapMoneyaddress];
    [self.backgroundViews addSubview:self.viewMoneyaddress];
    [self.viewMoneyaddress mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.viewEWM.mas_bottom).offset(1.2);
        make.left.equalTo(self.backgroundViews.mas_left).offset(0);
        make.right.equalTo(self.backgroundViews.mas_right).offset(0);
        make.height.equalTo(@(48));
        
    }];
    */
    
   
    
    self.viewSeven = [[UIView alloc] init];
    self.viewSeven.backgroundColor = [UIColor whiteColor];
    UITapGestureRecognizer *tapSeven=[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapViewSevenClick:)];
    tapSeven.delegate = self;
    [self.viewSeven addGestureRecognizer:tapSeven];
    [self.backgroundViews addSubview:self.viewSeven];
    [self.viewSeven mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.viewThree.mas_bottom).offset(13);
        make.left.equalTo(self.backgroundViews.mas_left).offset(0);
        make.right.equalTo(self.backgroundViews.mas_right).offset(0);
        make.height.equalTo(@(48));
        
    }];
    self.viewFour = [[UIView alloc] init];
    self.viewFour.backgroundColor = [UIColor whiteColor];
    UITapGestureRecognizer *tapFour=[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapViewFourClick:)];
    tapFour.delegate = self;
    [self.viewFour addGestureRecognizer:tapFour];
    [self.backgroundViews addSubview:self.viewFour];
    [self.viewFour mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.viewSeven.mas_bottom).offset(13);
        make.left.equalTo(self.backgroundViews.mas_left).offset(0);
        make.right.equalTo(self.backgroundViews.mas_right).offset(0);
        make.height.equalTo(@(48));
        
    }];
    
    //    self.viewFive = [[UIView alloc] init];
    //    self.viewFive.backgroundColor = [UIColor whiteColor];
    //    UITapGestureRecognizer *tapFive=[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapViewFiveClick:)];
    //    tapFive.delegate = self;
    //    [self.viewFive addGestureRecognizer:tapFive];
    //    [self.backgroundViews addSubview:self.viewFive];
    //    [self.viewFive mas_makeConstraints:^(MASConstraintMaker *make) {
    //
    //        make.top.equalTo(self.viewFour.mas_bottom).offset(1.2);
    //        make.left.equalTo(self.backgroundViews.mas_left).offset(0);
    //        make.right.equalTo(self.backgroundViews.mas_right).offset(0);
    //        make.height.equalTo(@(48));
    //
    //    }];
    
    self.viewSix = [[UIView alloc] init];
    self.viewSix.backgroundColor = [UIColor whiteColor];
    UITapGestureRecognizer *tapSix=[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapViewSixClick:)];
    tapSix.delegate = self;
    [self.viewSix addGestureRecognizer:tapSix];
    [self.backgroundViews addSubview:self.viewSix];
    [self.viewSix mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.viewFour.mas_bottom).offset(1.2);
        make.left.equalTo(self.backgroundViews.mas_left).offset(0);
        make.right.equalTo(self.backgroundViews.mas_right).offset(0);
        make.height.equalTo(@(48));
        
    }];
    
    //头像
    self.HeaderImageView = [[UIImageView alloc] init];
    
    [self.HeaderImageView sd_setImageWithURL:[NSURL URLWithString:self.headerUrlstr] placeholderImage:[UIImage imageNamed:@"icon_touxiang"]];
    self.HeaderImageView.layer.cornerRadius =63/2;
    self.HeaderImageView.clipsToBounds = YES;
    [self.viewOne addSubview:self.HeaderImageView];
    [self.HeaderImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.viewOne.mas_top).offset(16.5);
        make.left.equalTo(self.viewOne.mas_left).offset(15);
        make.width.and.height.equalTo(@(63));
    }];
    
    UIImageView *imageOne = [[UIImageView alloc] init];
    imageOne.image=[UIImage imageNamed:@"icon_jt_you"];
    [self.viewOne addSubview:imageOne];
    [imageOne mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.viewOne.mas_top).offset(42);
        make.right.equalTo(self.viewOne.mas_right).offset(-16);
        
    }];
    
    UILabel *labOne = [[UILabel alloc] init];
    labOne.text = @"修改";
    labOne.textAlignment = NSTextAlignmentRight;
    labOne.font = [UIFont systemFontOfSize:16];
    [self.viewOne addSubview:labOne];
    [labOne mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.self.viewOne.mas_top).offset(38);
        make.bottom.equalTo(self.self.viewOne.mas_bottom).offset(-38);
        make.right.equalTo(imageOne.mas_left).offset(-12);
        make.width.equalTo(@(60));
        
    }];
    
    UIImageView *imageSeven = [[UIImageView alloc] init];
    imageSeven.image=[UIImage imageNamed:@"icon_jt_you"];
    [self.viewSeven addSubview:imageSeven];
    [imageSeven mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.viewSeven.mas_top).offset(18);
        make.right.equalTo(self.viewSeven.mas_right).offset(-16);
        
    }];
    
    UILabel *labtTwo =[[UILabel alloc] init];
    labtTwo.text = @"昵称";
    labtTwo.font = [UIFont systemFontOfSize:16];
    [self.viewTwo addSubview:labtTwo];
    [labtTwo mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(self.viewTwo.mas_left).offset(15);
        make.top.equalTo(self.viewTwo.mas_top).offset(14);
        make.bottom.equalTo(self.viewTwo.mas_bottom).offset(-14);
        make.width.equalTo(@(80));
        
    }];
    
    UILabel *labtThree =[[UILabel alloc] init];
    labtThree.text = @"手机号码";
    labtThree.font = [UIFont systemFontOfSize:16];
    [self.viewThree addSubview:labtThree];
    [labtThree mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(self.viewThree.mas_left).offset(15);
        make.top.equalTo(self.viewThree.mas_top).offset(14);
        make.bottom.equalTo(self.viewThree.mas_bottom).offset(-14);
        make.width.equalTo(@(110));
        
    }];
    
    UILabel *labtFour =[[UILabel alloc] init];
    labtFour.text = @"性别";
    labtFour.font = [UIFont systemFontOfSize:16];
    [self.viewFour addSubview:labtFour];
    [labtFour mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(self.viewFour.mas_left).offset(15);
        make.top.equalTo(self.viewFour.mas_top).offset(14);
        make.bottom.equalTo(self.viewFour.mas_bottom).offset(-14);
        make.width.equalTo(@(80));
        
    }];
    
//    UILabel *labtFive =[[UILabel alloc] init];
//    labtFive.text = @"年龄";
//    labtFive.font = [UIFont systemFontOfSize:16];
//    [self.viewFive addSubview:labtFive];
//    [labtFive mas_makeConstraints:^(MASConstraintMaker *make) {
//
//        make.left.equalTo(self.viewFive.mas_left).offset(15);
//        make.top.equalTo(self.viewFive.mas_top).offset(14);
//        make.bottom.equalTo(self.viewFive.mas_bottom).offset(-14);
//        make.width.equalTo(@(80));
//
//    }];
    
    UILabel *labtSix =[[UILabel alloc] init];
    labtSix.text = @"所在城市";
    labtSix.font = [UIFont systemFontOfSize:16];
    [self.viewSix addSubview:labtSix];
    [labtSix mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(self.viewSix.mas_left).offset(15);
        make.top.equalTo(self.viewSix.mas_top).offset(14);
        make.bottom.equalTo(self.viewSix.mas_bottom).offset(-14);
        make.width.equalTo(@(110));
        
    }];
    
    UILabel *labtSeven =[[UILabel alloc] init];
    labtSeven.text = @"身份验证";
    labtSeven.font = [UIFont systemFontOfSize:16];
    [self.viewSeven addSubview:labtSeven];
    [labtSeven mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(self.viewSeven.mas_left).offset(15);
        make.top.equalTo(self.viewSeven.mas_top).offset(14);
        make.bottom.equalTo(self.viewSeven.mas_bottom).offset(-14);
        make.width.equalTo(@(110));
        
    }];
    
    self.labSecond = [[UILabel alloc] init];
    //昵称
    if (num==1)
    {
        self.labSecond.text = [NSString stringWithFormat:@"%@",self.str1];
    }else{
        
        self.labSecond.text = @"";
    }
    
    self.labSecond.textAlignment = NSTextAlignmentRight;
    self.labSecond.font = [UIFont systemFontOfSize:16];
    [self.viewTwo addSubview:self.labSecond];
    [self.labSecond mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.right.equalTo(self.viewTwo.mas_right).offset(-15);
        make.top.equalTo(self.viewTwo.mas_top).offset(14);
        make.bottom.equalTo(self.viewTwo.mas_bottom).offset(-14);
        make.width.equalTo(@(220));
        
    }];
    
    self.labThred = [[UILabel alloc] init];
    //电话
    if (num==1)
    {
        self.labThred.text = [NSString stringWithFormat:@"%@",self.str2];
    }else{
        self.labThred.text = @"";
        
    }
    
    self.labThred.textAlignment = NSTextAlignmentRight;
    self.labThred.font = [UIFont systemFontOfSize:16];
    [self.viewThree addSubview:self.labThred];
    [self.labThred mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.right.equalTo(self.viewThree.mas_right).offset(-15);
        make.top.equalTo(self.viewThree.mas_top).offset(14);
        make.bottom.equalTo(self.viewThree.mas_bottom).offset(-14);
        make.width.equalTo(@(200));
        
    }];
    
    self.labFours = [[UILabel alloc] init];
    //暂时写死
    if (num==1)
    {
        if ([self.gender isEqualToString:@"0"])
        {
            self.labFours.text = @"";
        }else{
        if ([self.gender isEqualToString:@"1"])
        {
            self.labFours.text = @"男";
        }else if ([self.gender isEqualToString:@"2"]){
            
            self.labFours.text = @"女";
        }else{
            
            self.labFours.text = @"";
        }
        }
    }else{
        
        self.labFours.text = @"";
    }
    
    self.labFours.textAlignment = NSTextAlignmentRight;
    self.labFours.font = [UIFont systemFontOfSize:16];
    [self.viewFour addSubview:self.labFours];
    [self.labFours mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.right.equalTo(self.viewFour.mas_right).offset(-15);
        make.top.equalTo(self.viewFour.mas_top).offset(14);
        make.bottom.equalTo(self.viewFour.mas_bottom).offset(-14);
        make.width.equalTo(@(40));
        
    }];
    
//    self.labFives = [[UILabel alloc] init];
//    //暂时写死
//    self.labFives.text = @"32岁";
//    self.labFives.textAlignment = NSTextAlignmentRight;
//    self.labFives.font = [UIFont systemFontOfSize:16];
//    [self.viewFive addSubview:self.labFives];
//    [self.labFives mas_makeConstraints:^(MASConstraintMaker *make) {
//
//        make.right.equalTo(self.viewFive.mas_right).offset(-15);
//        make.top.equalTo(self.viewFive.mas_top).offset(14);
//        make.bottom.equalTo(self.viewFive.mas_bottom).offset(-14);
//        make.width.equalTo(@(80));
//
//    }];
    
    self.labSixes = [[UILabel alloc] init];
    //暂时写死
    if (num==1)
    {
        if ([self.city isEqualToString:@""])
        {
          self.labSixes.text = @"";
        }else{
            
            self.labSixes.text = [NSString stringWithFormat:@"%@",self.city];
        }
        
    }else{
        
        self.labSixes.text = @"";
        
    }
    
    self.labSixes.textAlignment = NSTextAlignmentRight;
    self.labSixes.font = [UIFont systemFontOfSize:16];
    [self.viewSix addSubview:self.labSixes];
    [self.labSixes mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.right.equalTo(self.viewSix.mas_right).offset(-15);
        make.top.equalTo(self.viewSix.mas_top).offset(14);
        make.bottom.equalTo(self.viewSix.mas_bottom).offset(-14);
        make.width.equalTo(@(120));
        
    }];
    
    self.labSevens = [[UILabel alloc] init];
    //暂时写死
    if (num==1)
    {
        if (self.status==1)
        {
            self.labSevens.text = @"未认证";
            self.viewSeven.userInteractionEnabled=YES;
        }else if (self.status==2){
            
            self.labSevens.text = @"认证中";
            self.viewSeven.userInteractionEnabled=YES;
        }else if (self.status==3){
            
            self.labSevens.text = @"已认证";
            self.viewSeven.userInteractionEnabled=NO;
        }else{
            
             self.viewSeven.userInteractionEnabled=YES;
        }
        
    }else{
        
        self.labSevens.text = @"";
    }
    
    self.labSevens.textColor = [UIColor grayColor];
    self.labSevens.textAlignment = NSTextAlignmentRight;
    self.labSevens.font = [UIFont systemFontOfSize:16];
    [self.viewSeven addSubview:self.labSevens];
    [self.labSevens mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.right.equalTo(imageSeven.mas_left).offset(-12);
        make.top.equalTo(self.viewSeven.mas_top).offset(14);
        make.bottom.equalTo(self.viewSeven.mas_bottom).offset(-14);
        make.width.equalTo(@(100));
        
    }];
    
    /*
    UILabel *labtEWM =[[UILabel alloc] init];
    labtEWM.text = @"我的二维码";
    labtEWM.font = [UIFont systemFontOfSize:16];
    [self.viewEWM addSubview:labtEWM];
    [labtEWM mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(self.viewEWM.mas_left).offset(15);
        make.top.equalTo(self.viewEWM.mas_top).offset(14);
        make.bottom.equalTo(self.viewEWM.mas_bottom).offset(-14);
        make.width.equalTo(@(110));
        
    }];
    
    UIImageView *imageEWM = [[UIImageView alloc] init];
    imageEWM.image=[UIImage imageNamed:@"icon_jt_you"];
    [self.viewEWM addSubview:imageEWM];
    [imageEWM mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.viewEWM.mas_top).offset(18);
        make.right.equalTo(self.viewEWM.mas_right).offset(-16);
        
    }];
    
    UIImageView *imageEWM1 = [[UIImageView alloc] init];
    imageEWM1.image=[UIImage imageNamed:@"icon_erwm"];
    [self.viewEWM addSubview:imageEWM1];
    [imageEWM1 mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.viewEWM.mas_top).offset(15.5);
        make.right.equalTo(imageEWM.mas_right).offset(-12);
        
    }];
    
    UILabel *labMoney =[[UILabel alloc] init];
    labMoney.text = @"钱包地址";
    labMoney.font = [UIFont systemFontOfSize:16];
    [self.viewMoneyaddress addSubview:labMoney];
    [labMoney mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(self.viewMoneyaddress.mas_left).offset(15);
        make.top.equalTo(self.viewMoneyaddress.mas_top).offset(14);
        make.bottom.equalTo(self.viewMoneyaddress.mas_bottom).offset(-14);
        make.width.equalTo(@(110));
        
    }];
    
    UIImageView *imageMoney = [[UIImageView alloc] init];
    imageMoney.image=[UIImage imageNamed:@"icon_jt_you"];
    [self.viewMoneyaddress addSubview:imageMoney];
    [imageMoney mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.viewMoneyaddress.mas_top).offset(18);
        make.right.equalTo(self.viewMoneyaddress.mas_right).offset(-16);
        
    }];
    */
    
    
    
    if (self.backgroundViews.subviews.count>0){
        
        [self.backgroundViews mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.equalTo(self.backgroundViews.subviews.lastObject).offset(30);
            
        }];
        
    }
    
    
}

-(void)tapViewOneClick:(UIGestureRecognizer *)tp{
    
    //显示弹出框列表选择
    
    UIAlertController* alert = [[UIAlertController alloc] init];
    
    UIAlertAction* cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * action) {
        //响应事件
        NSLog(@"action = %@", action);
    }];
    UIAlertAction* deleteAction = [UIAlertAction actionWithTitle:@"我的相册" style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) {
        //响应事件
        [self pickImage];
    }];
    UIAlertAction* saveAction = [UIAlertAction actionWithTitle:@"拍照" style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) {
        //响应事件
        NSString* deviceModel = [Tools getCurrentDeviceModel];
        if([deviceModel isEqualToString:@"iPhone Simulator (i386)"] || [deviceModel isEqualToString:@"iPhone Simulator (x86_64)"])
        {
            
            UIAlertController* alerts = [UIAlertController alertControllerWithTitle:@"提示" message:@"拍照请用真机测试" preferredStyle:UIAlertControllerStyleAlert];
            
            UIAlertAction* defaultActions = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) {
                //响应事件
                
            }];
            
            [alerts addAction:defaultActions];
            [self presentViewController:alerts animated:YES completion:nil];
            
        } else {
            [self snapImage];
        }
    }];
    [alert addAction:saveAction];
    [alert addAction:cancelAction];
    [alert addAction:deleteAction];
    [self presentViewController:alert animated:YES completion:nil];
    
}
//修改昵称
-(void)tapViewTwoClick:(UIGestureRecognizer *)tp{
    
    UIAlertController* alert = [UIAlertController alertControllerWithTitle:@"请输入" message:@"" preferredStyle:UIAlertControllerStyleAlert];
    
    UIAlertAction* cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * action) {
        //响应事件
        
    }];
    
    UIAlertAction* okAction = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) {
        //响应事件
        //得到文本信息
        for(UITextField *text in alert.textFields){
            NSLog(@"text = %@", text.text);
           
            if (text.text.length == 0)
            {
                
                
            }else{
                /*
                 参数：userId
                 参数：file
                 参数：nickName
                 参数：gender
                 参数：city
                 
                 */
                int userId=[[[NSUserDefaults standardUserDefaults] objectForKey:@"userId"] intValue];
                NSDictionary *dic=[NSDictionary dictionaryWithObjectsAndKeys:text.text,@"nickName",@(userId),@"userId", nil];
                __weak typeof(self) weakSelf = self;

                [GPosAPI requestConfigUserInfosWithParams:dic andCallback:^(id obj) {
                    if (obj ==nil)
                    {
                        [SVProgressHUD showErrorWithStatus:@"请求失败,请检查您的网络状态"];
                        [SVProgressHUD setDefaultStyle:SVProgressHUDStyleDark];
                        [SVProgressHUD setDefaultAnimationType:SVProgressHUDAnimationTypeFlat];
                        
                    }else{
                      
                        if ([[obj objectForKey:@"code"] integerValue] ==200) {
                            weakSelf.labSecond.text = text.text;
                            [[NSNotificationCenter defaultCenter]postNotificationName:@"changeUserName" object:nil userInfo:@{@"userNames":text.text}];
                           
                        }else if ([[obj objectForKey:@"code"] integerValue]==401 || [[obj objectForKey:@"code"] intValue] == 402){
                            
                             [[NSNotificationCenter defaultCenter] postNotificationName:@"NewLoginInView" object:nil];
                            UIStoryboard * mainStory = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
                            XMRegisterViewController *VC = [mainStory instantiateInitialViewController];
                            [[NSUserDefaults standardUserDefaults] removeObjectForKey:@"passWord"];
                            VC.hidesBottomBarWhenPushed=YES;
                            //设置当前窗口的根控制器
                            [UIApplication sharedApplication].keyWindow.rootViewController=VC;
                            [SVProgressHUD showInfoWithStatus:[obj objectForKey:@"message"]];
                            [SVProgressHUD setDefaultStyle:SVProgressHUDStyleDark];
                            [SVProgressHUD setDefaultAnimationType:SVProgressHUDAnimationTypeFlat];
                            
                            
                        }
                        
                        else{
                            
                            [SVProgressHUD showErrorWithStatus:[obj objectForKey:@"message"]];
                            [SVProgressHUD setDefaultStyle:SVProgressHUDStyleDark];
                            [SVProgressHUD setDefaultAnimationType:SVProgressHUDAnimationTypeFlat];
                        }
                        
                    }
                }];
                
                
            }
            
        }
    }];
    [alert addTextFieldWithConfigurationHandler:^(UITextField *textField) {
        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(alertViewTextFieldDidChange:) name:UITextFieldTextDidChangeNotification object:textField];
    }];
    
    [alert addAction:okAction];
    [alert addAction:cancelAction];
    [self presentViewController:alert animated:YES completion:nil];
    
}
-(void)alertViewTextFieldDidChange:(NSNotification *)notification
{
    
   UITextField *textField = notification.object;
    
    if (textField.text.length >= 20)
    {
     NSString * str=[textField.text substringToIndex:20];
        textField.text=str;
    }
    
}

-(void)tapViewThreeClick:(UIGestureRecognizer *)tp{
    
    
    
}
-(void)tapViewFourClick:(UIGestureRecognizer *)tp{
    __weak typeof(self) weakSelf = self;
    if ([self.labFours.text isEqualToString:@"男"])
    {
        /*
         参数：userId
         参数：file
         参数：nickName
         参数：gender
         参数：city
         
         */
        
        int userId=[[[NSUserDefaults standardUserDefaults] objectForKey:@"userId"] intValue];
        NSDictionary *dic=[NSDictionary dictionaryWithObjectsAndKeys:@(2),@"gender",@(userId),@"userId", nil];
        [GPosAPI requestConfigUserInfosWithParams:dic andCallback:^(id obj) {
            if (obj ==nil)
            {
                [SVProgressHUD showErrorWithStatus:@"请求失败,请检查您的网络状态"];
                [SVProgressHUD setDefaultStyle:SVProgressHUDStyleDark];
                [SVProgressHUD setDefaultAnimationType:SVProgressHUDAnimationTypeFlat];
                
            }else{
                
                if ([[obj objectForKey:@"code"] integerValue] ==200) {
                    weakSelf.hud=[WKProgressHUD popMessage:@"修改成功" inView:weakSelf.view duration:1 animated:YES];
                    weakSelf.labFours.text=@"女";
                }else if ([[obj objectForKey:@"code"] integerValue]==401 || [[obj objectForKey:@"code"] intValue] == 402){
                    
                     [[NSNotificationCenter defaultCenter] postNotificationName:@"NewLoginInView" object:nil];
                    UIStoryboard * mainStory = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
                    XMRegisterViewController *VC = [mainStory instantiateInitialViewController];
                    [[NSUserDefaults standardUserDefaults] removeObjectForKey:@"passWord"];
                    VC.hidesBottomBarWhenPushed=YES;
                    //设置当前窗口的根控制器
                    [UIApplication sharedApplication].keyWindow.rootViewController=VC;
                    [SVProgressHUD showInfoWithStatus:[obj objectForKey:@"message"]];
                    [SVProgressHUD setDefaultStyle:SVProgressHUDStyleDark];
                    [SVProgressHUD setDefaultAnimationType:SVProgressHUDAnimationTypeFlat];
                    
                    
                }
                else{
                    
                    [SVProgressHUD showErrorWithStatus:[obj objectForKey:@"message"]];
                    [SVProgressHUD setDefaultStyle:SVProgressHUDStyleDark];
                    [SVProgressHUD setDefaultAnimationType:SVProgressHUDAnimationTypeFlat];
                }
                
            }
        }];
        
        
    }else{
        int userId=[[[NSUserDefaults standardUserDefaults] objectForKey:@"userId"] intValue];
        NSDictionary *dic=[NSDictionary dictionaryWithObjectsAndKeys:@(1),@"gender",@(userId),@"userId", nil];
        [GPosAPI requestConfigUserInfosWithParams:dic andCallback:^(id obj) {
            if (obj ==nil)
            {
                [SVProgressHUD showErrorWithStatus:@"请求失败,请检查您的网络状态"];
                [SVProgressHUD setDefaultStyle:SVProgressHUDStyleDark];
                [SVProgressHUD setDefaultAnimationType:SVProgressHUDAnimationTypeFlat];
                
            }else{
                
                if ([[obj objectForKey:@"code"] integerValue] ==200) {
                     weakSelf.hud=[WKProgressHUD popMessage:@"修改成功" inView:weakSelf.view duration:1 animated:YES];
                     weakSelf.labFours.text=@"男";
                }else if ([[obj objectForKey:@"code"] integerValue]==401 || [[obj objectForKey:@"code"] intValue] == 402){
                    
                        [[NSNotificationCenter defaultCenter] postNotificationName:@"NewLoginInView" object:nil];
                    UIStoryboard * mainStory = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
                    XMRegisterViewController *VC = [mainStory instantiateInitialViewController];
                    [[NSUserDefaults standardUserDefaults] removeObjectForKey:@"passWord"];
                    VC.hidesBottomBarWhenPushed=YES;
                    //设置当前窗口的根控制器
                    [UIApplication sharedApplication].keyWindow.rootViewController=VC;
                    [SVProgressHUD showInfoWithStatus:[obj objectForKey:@"message"]];
                    [SVProgressHUD setDefaultStyle:SVProgressHUDStyleDark];
                    [SVProgressHUD setDefaultAnimationType:SVProgressHUDAnimationTypeFlat];
                    
                    
                }
                else{
                    
                    [SVProgressHUD showErrorWithStatus:[obj objectForKey:@"message"]];
                    [SVProgressHUD setDefaultStyle:SVProgressHUDStyleDark];
                    [SVProgressHUD setDefaultAnimationType:SVProgressHUDAnimationTypeFlat];
                }
                
            }
        }];
       
    }
    
}
//年龄
-(void)tapViewFiveClick:(UIGestureRecognizer *)tp{
    
    NSLog(@"5");
    
}
-(void)tapViewSixClick:(UIGestureRecognizer *)tp{
    self.viewSix.userInteractionEnabled=NO;
    if (tp.state == UIGestureRecognizerStateEnded){//该判断的作用是防止手势多次点击后重复加载页面
        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
            self.viewSix.userInteractionEnabled=YES;
        });
        SkyerCityPicker *skyerCityPicker=[[SkyerCityPicker alloc] init];
        skyerCityPicker.delegate =self;
        
    }
}
#pragma skyerDelegate
-(void)backCityName:(NSString *)Name{
    __weak typeof(self) weakSelf = self;
    int userId=[[[NSUserDefaults standardUserDefaults] objectForKey:@"userId"] intValue];
    NSDictionary *dic=[NSDictionary dictionaryWithObjectsAndKeys:Name,@"city",@(userId),@"userId", nil];
    [GPosAPI requestConfigUserInfosWithParams:dic andCallback:^(id obj) {
        if (obj ==nil)
        {
            [SVProgressHUD showErrorWithStatus:@"请求失败,请检查您的网络状态"];
            [SVProgressHUD setDefaultStyle:SVProgressHUDStyleDark];
            [SVProgressHUD setDefaultAnimationType:SVProgressHUDAnimationTypeFlat];
            
        }else{
            
            if ([[obj objectForKey:@"code"] integerValue] ==200) {
                weakSelf.hud=[WKProgressHUD popMessage:@"修改成功" inView:weakSelf.view duration:1 animated:YES];
                weakSelf.labSixes.text = Name;
            }else if ([[obj objectForKey:@"code"] integerValue]==401 || [[obj objectForKey:@"code"] intValue] == 402){
                
                 [[NSNotificationCenter defaultCenter] postNotificationName:@"NewLoginInView" object:nil];
                UIStoryboard * mainStory = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
                XMRegisterViewController *VC = [mainStory instantiateInitialViewController];
                [[NSUserDefaults standardUserDefaults] removeObjectForKey:@"passWord"];
                VC.hidesBottomBarWhenPushed=YES;
                //设置当前窗口的根控制器
                [UIApplication sharedApplication].keyWindow.rootViewController=VC;
                [SVProgressHUD showInfoWithStatus:[obj objectForKey:@"message"]];
                [SVProgressHUD setDefaultStyle:SVProgressHUDStyleDark];
                [SVProgressHUD setDefaultAnimationType:SVProgressHUDAnimationTypeFlat];
                
                
            }
            else{
                
                [SVProgressHUD showErrorWithStatus:[obj objectForKey:@"message"]];
                [SVProgressHUD setDefaultStyle:SVProgressHUDStyleDark];
                [SVProgressHUD setDefaultAnimationType:SVProgressHUDAnimationTypeFlat];
            }
            
        }
    }];
    
    
}

-(void)tapViewSevenClick:(UIGestureRecognizer *)tp{
    if ([self.labSevens.text isEqualToString:@"认证中"])
    {
        self.hud=[WKProgressHUD popMessage:@"身份认证审核中!" inView:self.view duration:1.5 animated:YES];
    }else{
    IdentityVerificationViewController *vc=[[IdentityVerificationViewController alloc] init];
    
    vc.hidesBottomBarWhenPushed = YES;
    [self.navigationController pushViewController:vc animated:YES];
    }
    
}
//从相册里找
- (void) pickImage {
    
    UIImagePickerController *ipc = [[UIImagePickerController alloc] init];
    ipc.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
    ipc.delegate = self;
    ipc.allowsEditing = YES;
    
    [self presentViewController:ipc animated:YES completion:nil];
    
}
//拍照
- (void)snapImage {
    UIImagePickerController *ipc = [[UIImagePickerController alloc] init];
    ipc.sourceType = UIImagePickerControllerSourceTypeCamera;
    ipc.delegate = self;
    ipc.allowsEditing = NO;
    [self presentViewController:ipc animated:YES completion:nil];
}
#pragma mark - UIImagePickerControllerDelegate

- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker {
    
    [picker dismissViewControllerAnimated:YES completion:nil];
}
-(void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
    NSString *infoKey = @"UIImagePickerControllerEditedImage";
    if(picker.sourceType==UIImagePickerControllerSourceTypeCamera){
        infoKey = @"UIImagePickerControllerOriginalImage";
    }
    
    UIImage *img = [info objectForKey:infoKey];//
    
    [picker dismissViewControllerAnimated:YES completion:^{
        
        UIImage *smallImage = [self scaleFromImage:img toSize:CGSizeMake(63.0f, 63.0f)];//将图片尺寸改为63*63
        
//        self.HeaderImageView.image = smallImage;
        //准备上传图片
          [self uploadImage:smallImage];
    }];
}
//上传的方法
-(void)uploadImage:(UIImage *)img{
    
    
    AFHTTPSessionManager *manager=[AFHTTPSessionManager manager];
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"application/json", @"text/json", @"text/javascript",@"text/html",@"text/plain", nil];
    
    
    manager.requestSerializer = [AFJSONRequestSerializer serializer];//请求
    manager.responseSerializer = [AFHTTPResponseSerializer serializer];//响应
    
    // 2.设置证书模式
    NSString * cerPath = [[NSBundle mainBundle] pathForResource:@"www.gpos-wallet.com" ofType:@"cer"];
    NSData * cerData = [NSData dataWithContentsOfFile:cerPath];
    manager.securityPolicy.pinnedCertificates = [[NSArray alloc] initWithObjects:cerData, nil];
    // 客户端是否信任非法证书
    manager.securityPolicy.allowInvalidCertificates = YES;
    // 是否在证书域字段中验证域名
    [manager.securityPolicy setValidatesDomainName:NO];
    [manager.requestSerializer setValue:@"iphone"forHTTPHeaderField:@"user-agent"];
    [manager.requestSerializer setValue:[[NSUserDefaults standardUserDefaults] objectForKey:@"user_token"]forHTTPHeaderField:@"user-token"];
    [manager.requestSerializer setValue:[[NSUserDefaults standardUserDefaults] objectForKey:@"userId"]forHTTPHeaderField:@"userId"];
    NSLog(@"%@",[[NSUserDefaults standardUserDefaults] objectForKey:@"user_token"]);
    manager.requestSerializer.timeoutInterval = 50;
    
    //压缩图片
    NSData *Data =UIImageJPEGRepresentation(img,0.5);
    /*
     参数：userId
     参数：file
     参数：nickName
     参数：gender
     参数：city
     
     */
    __weak typeof(self) weakSelf = self;
    int userId=[[[NSUserDefaults standardUserDefaults] objectForKey:@"userId"] intValue];
    NSDictionary *dic=[NSDictionary dictionaryWithObjectsAndKeys:@(userId),@"userId", nil];
    NSString* IPStr = @"http://148.163.164.19:8085/user/setDetail";
//     NSString* IPStr = @"https://192.168.0.111:8000/pos-gpos-app/mall/settled";
    [manager POST:IPStr parameters:dic constructingBodyWithBlock:^(id<AFMultipartFormData>  _Nonnull formData) {
        
        NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
        formatter.dateFormat = @"yyyyMMddHHmmss";
        NSString *str = [formatter stringFromDate:[NSDate date]];
        NSString *fileName = [NSString stringWithFormat:@"%@.jpg", str];
        //上传的参数(上传图片，以文件流的格式)
        [formData appendPartWithFileData:Data
                                    name:@"file"
                                fileName:fileName
                                mimeType:@"image/jpeg"];
        
        
    } success:^(NSURLSessionDataTask * _Nonnull task, id  _Nonnull responseObject) {
        NSDictionary *dataDic=[NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:nil];
        NSLog(@"%@",dataDic);
        if (dataDic==nil) {
            [SVProgressHUD showErrorWithStatus:@"请求失败,请检查您的网络状态"];
            [SVProgressHUD setDefaultStyle:SVProgressHUDStyleDark];
            [SVProgressHUD setDefaultAnimationType:SVProgressHUDAnimationTypeFlat];
        }else{
            
            if ([[dataDic objectForKey:@"code"] integerValue]==200)
            {
                weakSelf.hud=[WKProgressHUD popMessage:@"上传成功" inView:weakSelf.view duration:1 animated:YES];
                weakSelf.HeaderImageView.image = img;
                [[NSNotificationCenter defaultCenter]postNotificationName:@"changeUserPict" object:nil userInfo:@{@"userPict":img}];
            }else if ([[dataDic objectForKey:@"code"] integerValue]==401 || [[dataDic objectForKey:@"code"] intValue] == 402){
                
                [[NSNotificationCenter defaultCenter] postNotificationName:@"NewLoginInView" object:nil];
                UIStoryboard * mainStory = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
                XMRegisterViewController *VC = [mainStory instantiateInitialViewController];
                [[NSUserDefaults standardUserDefaults] removeObjectForKey:@"passWord"];
                VC.hidesBottomBarWhenPushed=YES;
                //设置当前窗口的根控制器
                [UIApplication sharedApplication].keyWindow.rootViewController=VC;
                [SVProgressHUD showInfoWithStatus:[dataDic objectForKey:@"message"]];
                [SVProgressHUD setDefaultStyle:SVProgressHUDStyleDark];
                [SVProgressHUD setDefaultAnimationType:SVProgressHUDAnimationTypeFlat];
                
                
            }else{
                
                [SVProgressHUD showErrorWithStatus:[dataDic objectForKey:@"message"]];
                [SVProgressHUD setDefaultStyle:SVProgressHUDStyleDark];
                [SVProgressHUD setDefaultAnimationType:SVProgressHUDAnimationTypeFlat];
            }
        }
        
        
    } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
        
    }];
    
}
// 改变图像的尺寸，方便上传服务器
- (UIImage *) scaleFromImage: (UIImage *) image toSize: (CGSize) size {
    UIGraphicsBeginImageContext(size);
    [image drawInRect:CGRectMake(0, 0, size.width, size.height)];
    UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    return newImage;
}
//我的二维码点击事件
-(void)tapsEWM:(UIGestureRecognizer *)tp{
    
    EWMCodeViewController *vc=[[EWMCodeViewController alloc] init];
    vc.ERMStr=self.MoneyAddress;
    vc.hidesBottomBarWhenPushed=YES;
    [self.navigationController pushViewController:vc animated:YES];
}

-(void)tapsMoneyaddress:(UIGestureRecognizer *)tp{
    
    NSLog(@"钱包地址");
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
